<?php

namespace Fuel\Migrations;

class Create_reservations
{
	public function up()
	{
		\DBUtil::create_table('reservations', array(
			'id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true),
			'order_id' => array('constraint' => 11, 'type' => 'int'),
			'row' => array('type' => 'smallint'),
			'seat' => array('type' => 'smallint')

		), array('id'));
                
                $all_reservations = array(
                    array(1,2,3), array(1,2,4), array(1,2,5),
                    array(1,2,6), array(2,1,2), array(2,1,3),
                    array(2,2,2), array(2,2,3), array(3,3,3),
                    array(3,3,4), array(3,1,1), array(4,1,1),
                    array(4,1,2), array(4,1,3), array(5,4,4),
                    array(5,3,3), array(5,1,2), array(6,4,2),
                    array(6,4,3), array(6,4,4), array(6,4,5),
                    array(7,5,5), array(8,2,2), array(8,2,3) 
                );
                
                foreach($all_reservations as $data) {
                    $reservation = \Model_Orm_Reservation::forge();
                    $reservation->order_id = $data[0];
                    $reservation->row = $data[1];
                    $reservation->seat = $data[2];
                    $reservation->save();
                }
	}

	public function down()
	{
		\DBUtil::drop_table('reservations');
	}
}